package com.tridion.utilities.verifier.model;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import com.tridion.utilities.verifier.model.internal.Release;

/**
 * Represents an installation with all it's properties.
 * 
 * @author Daniel Neagu
 */
public class ContentDeliveryInstallation {

    /**
     * The root location where this installation is.
     */
    private final File rootLocation;
    
    /**
     * The type of this installation.
     */
    private InstallationType type;
    
    /**
     * Location where the libs are.
     */
    private File libFolder;
    
    /**
     * Location where the configuration files are.
     */
    private File configFolder;
    
    /**
     * The jars included in this installation.
     */
    private List<JarFile> jars;
    
    /**
     * Release of the CD installation.
     */
    private Release release;
    
    /**
     * Possible minor release of the CD installation.
     */
    private Release minorRelease;
    
    /**
     * The messages regarding this installation.
     */
    private final List<StatusMessage> messages = new ArrayList<StatusMessage>();
    
    /**
     * Simple constructor that just sets the root location.
     * 
     * @param rootLocation the root location of the installation.
     */
    public ContentDeliveryInstallation(final File rootLocation) {
        this.rootLocation = rootLocation;
    }
    
    /**
     * Gets the root location of the installation.
     * 
     * @return the root location of the installation.
     */
    public File getRootLocation() {
        return rootLocation;
    }

    /**
     * Gets the type of the installation.
     * 
     * @return the type of the installation
     */
    public InstallationType getType() {
        return type;
    }

    /**
     * Sets the type of the installation.
     * 
     * @param type the type to set
     */
    public void setType(final InstallationType type) {
        this.type = type;
    }

    /**
     * Gets the lib folder for the installation.
     * 
     * @return the lib folder for the installation.
     */
    public File getLibFolder() {
        return libFolder;
    }

    /**
     * Sets the lib folder of this installation.
     * 
     * @param libFolder the libFolder to set
     */
    public void setLibFolder(final File libFolder) {
        this.libFolder = libFolder;
    }

    /**
     * Gets the config folder of this installation.
     * 
     * @return the config folder for the installation.
     */
    public File getConfigFolder() {
        return configFolder;
    }

    /**
     * Sets the config folder of this installation.
     * 
     * @param configFolder the configFolder to set
     */
    public void setConfigFolder(final File configFolder) {
        this.configFolder = configFolder;
    }

    /**
     * Gets the jar files from this installation.
     * 
     * @return the jar files from this installation.
     */
    public List<JarFile> getJars() {
        return jars;
    }

    /**
     * Sets the jar files from this installation.
     * 
     * @param jars the jars to set
     */
    public void setJars(final List<JarFile> jars) {
        this.jars = jars;
    }

    /**
     * Gets the main release of the installation.
     * 
     * @return the main release of the installation.
     */
    public Release getRelease() {
        return release;
    }

    /**
     * Sets release of this installation.
     * 
     * @param release the release to set
     */
    public void setRelease(final Release release) {
        this.release = release;
    }

    /**
     * Gets the possible minor release of the cd installation
     * 
     * @return the minorRelease of the cd installation
     */
    public Release getMinorRelease() {
        return minorRelease;
    }

    /**
     * Sets the minorRelease of the installation
     * 
     * @param minorRelease the minorRelease to set
     */
    public void setMinorRelease(final Release minorRelease) {
        this.minorRelease = minorRelease;
    }

    /**
     * Gets the messages regarding the cd installation
     * 
     * @return the messages regarding the cd installation
     */
    public List<StatusMessage> getMessages() {
        return messages;
    }
    
    /**
     * Adds a message regarding the cd installation
     * 
     * @param message The message regarding the cd installation to be added
     */
    public void addMessage(final StatusMessage message) {
        messages.add(message);
    }
}
